<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>中秋搞笑祝福合集 | 笑对明月，祝福满盈</title>
    <script src="../css/tailwind3.4.17.css"></script>
    <link href="../css/all.min.css" rel="stylesheet">
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .text-shadow {
                text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
            }
        }
    </style>
    <style>
        .control-btn {
            position: fixed;
            right: 20px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 10px 0;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .control-btn:hover {
            transform: scale(1.1);
        }
        #zoomIn {
            top: 40%;
        }
        #zoomOut {
            top: 50%;
        }
        #exportImg {
            top: 60%;
        }
        .article-container {
            transition: font-size 0.3s ease;
        }
    </style>
</head>
<body class="bg-gray-50 font-sans">
    <!-- 文章容器 -->
    <div class="container mx-auto px-4 py-8 max-w-3xl article-container" id="articleContent" contenteditable="true">
        <!-- 标题区域 -->
        <header class="text-center mb-10">
            <h1 class="text-[clamp(1.8rem,5vw,2.5rem)] font-bold text-amber-800 mb-3 text-shadow">中秋祝福，笑出月饼褶</h1>
            <p class="text-gray-600 italic">—— 这年头，没点梗都不好意思发祝福</p>
        </header>

        <!-- 正文内容 -->
        <div class="prose prose-lg mx-auto bg-white rounded-xl p-6 shadow-md">

            <p>"中秋建议：赏月时别张嘴。"</p>

            <p>"怕月亮看到你，误以为遇到同类——都是圆滚滚的。"</p>

            <br>

            <p>"月亮今晚不上班，但你要。"</p>

            <p>"不过没关系，月饼会有的，加班费...可能在路上被嫦娥偷吃了。"</p>

            <br>

            <p>"中秋快乐！虽然你月饼吃再多，也成不了月亮。"</p>

            <p>"顶多，成为一个会发光的...胖子。"</p>

            <br>

            <p>"祝您中秋安康，月饼少吃两块。"</p>

            <p>"剩下的留给我，年轻人消化好。"</p>

            <br>

            <br>

            <p class="text-right text-amber-700">祝你中秋笑出腹肌，吃嘛嘛香。</p>
        </div>
    </div>

    <!-- 控制按钮 -->
    <div class="control-btn bg-amber-500 text-white shadow-lg" id="zoomIn" title="放大文字">
        <i class="fas fa-search-plus text-xl"></i>
    </div>
    <div class="control-btn bg-amber-600 text-white shadow-lg" id="zoomOut" title="缩小文字">
        <i class="fas fa-search-minus text-xl"></i>
    </div>
    <div class="control-btn bg-amber-700 text-white shadow-lg" id="exportImg" title="导出长图">
        <i class="fas fa-download text-xl"></i>
    </div>

    <script>
        // 文字缩放功能
        let currentFontSize = 100; // 百分比
        const articleContent = document.getElementById('articleContent');
        
        document.getElementById('zoomIn').addEventListener('click', () => {
            if (currentFontSize < 150) { // 最大放大到150%
                currentFontSize += 10;
                articleContent.style.fontSize = `${currentFontSize}%`;
            }
        });
        
        document.getElementById('zoomOut').addEventListener('click', () => {
            if (currentFontSize > 70) { // 最小缩小到70%
                currentFontSize -= 10;
                articleContent.style.fontSize = `${currentFontSize}%`;
            }
        });

        // 导出长图功能 (需要html2canvas库支持)
        document.getElementById('exportImg').addEventListener('click', async () => {
            // 检查是否加载了html2canvas
            if (typeof html2canvas === 'undefined') {
                // 动态加载html2canvas库
                const script = document.createElement('script');
                script.src = 'https://html2canvas.hertzen.com/dist/html2canvas.min.js';
                script.onload = exportImage;
                document.body.appendChild(script);
            } else {
                exportImage();
            }
        });

        function exportImage() {
            html2canvas(document.getElementById('articleContent'), {
                scale: 2, // 提高分辨率
                useCORS: true,
                logging: false
            }).then(canvas => {
                // 创建下载链接
                const link = document.createElement('a');
                link.download = '中秋搞笑祝福_' + new Date().getTime() + '.png';
                link.href = canvas.toDataURL('image/png');
                link.click();
            }).catch(err => {
                alert('导出失败：' + err.message);
                console.error('导出失败', err);
            });
        }
    </script>
</body>
</html>